<?php

session_start();if ($_SESSION['count'] == "")
{   
	echo "Welcome!!! Your session ID is:  <b>".session_id()."</b>";	$_SESSION['count'] = 1; 
}else
{	echo "Welcome Back!!! Your session ID is:  <b>".session_id()."</b>";	$_SESSION['count'] = $_SESSION['count'] + 1;	
}$ip = getenv("REMOTE_ADDR");$current_session = session_id();	 echo "<br/>"."Host IP address is: ".$ip;?><!DOCTYPE html PUBLIC "-//W3C//DTD/XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml11-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
  <title>Vladimir Matsenko. CS4350 - Assignment 2</title><style type="text/css">
.output {cursor:hand;font-size: 16pt; font-weight:bold;}.special {font-size: 16pt; font-weight:bold; text-align:top; color:black;}caption {background-color:#2B60DE; color:#FDD017; font-weight:bold; font-size:11pt}thead td {background-color:#2B60DE;color:#FDD017;font-weight:bold;font-size:11pt}.tdChange {background-color: red; }.flt {float:left}p {text-align:justify}</style>
<script type="text/javascript">
/* <![CDATA[ */
function checkEnter(e)
{ 
var characterCode 

if(e && e.which)
{ 
e = e
characterCode = e.which 
}else{e = event
characterCode = e.keyCode 
}if(characterCode == 13){ 
return false 
}else{return true 
} 

}

</script>




</head>
<body bgcolor="#FDD017">

<br/>
<br/>
<br/>
<br/>
<hr width=90%> 
<br/>
<form action="PHP_set_cookie.php?Remove_Item=99999" target="_blank" method="POST">
<table>
<tr><td>Username:</td><td><input type="text" name="user_name"></td></tr>
<tr><td>Password:</td><td><input type="password" name="user_password"></td></tr>
<tr><td></td><td><input type="submit" name="btn_logon" value="Log in" ></td></tr>
<tr><td></td><td style ="font-size:10ptl; color:blue; cursor:hand" onclick="window.open('PHP_create_user.php','Title','resizable=no,width=1000,height=200, top=10, left=10')" >New user?</td></tr>
</table>
</form>
<hr width=90%> 
<?php
 	function display_comments1($user_id)
	 {if ($user_id != "no_display")
		 {    $conn = mysql_connect('mysql2.freehostia.com','vlamat3_CS4350','lab');$db = mysql_select_db('vlamat3_CS4350', $conn);$sql = "SELECT * FROM `Comments_text` WHERE user != '0' ";$rs = mysql_query($sql, $conn);	      echo "<table><thead><td>USER:</td><td>Comment:</td><td>Date:</td></thead>";while($row = mysql_fetch_array($rs)) 
    
          {	 	      echo "<tr><td >".$row['user'].
		     	"</td><td >".$row['CommentText'].
		    	"</td><td >".$row['CommentDate']."</td></tr>"; 
          }	      echo "</table>";     
         mysql_close($conn);	} 
	 }	display_comments1('*');?>




</body>
</html>
